home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 2,801 to 2,900 / aol-file-protocol-4400-2801-to-2900.zip / AOLDLs / C++ Files Library / HyperCuber Source / HyperCuber 2.0 Source.sit / HyperCuber 2.0 Source / CColorPane.cp < prev    next >
Text File  |  1993-09-23  |  3KB  |  124 lines

  1. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. //| CColorPane
  3. //|
  4. //| This implements a colored pane
  5. //|_________________________________________________________
  6.  
  7. #include "CColorPane.h"
  8. #include <Picker.h>
  9.  
  10.  
  11.  
  12. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  13. //| CColorPane::IColorPane
  14. //|
  15. //| Purpose: Initialize the colored pane.
  16. //|
  17. //| Parameters: none
  18. //|_________________________________________________________
  19.  
  20. void CColorPane::IColorPane(CView *anEnclosure, CBureaucrat *aSupervisor, short aWidth,
  21.                             short aHeight, short aHEncl, short aVEncl, SizingOption    aHSizing,
  22.                             SizingOption aVSizing, RGBColor *color)
  23. {
  24.  
  25.     IPane(anEnclosure, aSupervisor, aWidth, aHeight, aHEncl, aVEncl, aHSizing, aVSizing);
  26.                                                     //  Call superclass' initialization routine
  27.  
  28.     pane_color = *color;                            //  Set the fill color
  29.  
  30. }    //==== CColorPane::IColorPane() ====\\
  31.  
  32.  
  33. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. //| CColorPane::Draw
  35. //|
  36. //| Purpose: Draw the colored pane.
  37. //|
  38. //| Parameters: ignored
  39. //|_________________________________________________________
  40.  
  41. void CColorPane::Draw (Rect *area)
  42. {
  43.  
  44.     RGBColor    rgb_black =        {0x0000, 0x0000, 0x0000};
  45.  
  46.     Prepare();
  47.     RGBForeColor(&pane_color);                //  Change color or pattern to desired
  48.  
  49.     PaintRect(area);
  50.     
  51.     RGBForeColor(&rgb_black);                //  Change back to black
  52.  
  53. }    //==== CColorPane::Draw ====\\
  54.  
  55.  
  56.  
  57. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58. //| CColorPane::DoClick
  59. //|
  60. //| Purpose: Handle a click in the colored pane.  This method opens the color picker
  61. //|          and lets the user select a new color.
  62. //|
  63. //| Parameters: ignored
  64. //|___________________________________________________________________________________
  65.  
  66. void CColorPane::DoClick(Point hit, short modifierKeys, long when)
  67. {
  68.  
  69.     Point where_point = {0, 0};
  70.  
  71.     RGBColor color;
  72.     color = pane_color;
  73.     Boolean good = GetColor(where_point,                //  Let user select a new color
  74.                     "\pPlease choose a new color",
  75.                         &color, &color);
  76.     pane_color = color;
  77.  
  78.     Rect area;
  79.     LongToQDRect(&frame, &area);
  80.     Draw(&area);
  81.  
  82. }    //==== CColorPane::DoClick ====\\
  83.  
  84.  
  85.  
  86. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87. //| CColorPane::GetPaneColor
  88. //|
  89. //| Purpose: Get the current color of this pane.
  90. //|
  91. //| Parameters: color: receives the color of the pane
  92. //|___________________________________________________________________________________
  93.  
  94. void CColorPane::GetPaneColor(RGBColor *color)
  95. {
  96.  
  97.     *color = pane_color;
  98.  
  99. }    //==== CColorPane::GetPaneColor() ====\\
  100.  
  101.  
  102.  
  103. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. //| CColorPane::SetPaneColor
  105. //|
  106. //| Purpose: Set the current color of this pane.
  107. //|
  108. //| Parameters: color: the new color of the pane
  109. //|___________________________________________________________________________________
  110.  
  111. void CColorPane::SetPaneColor(RGBColor *color)
  112. {
  113.  
  114.     pane_color = *color;                                //  Change the color
  115.  
  116.     Rect area;
  117.     LongToQDRect(&frame, &area);                        //  Redraw the pane
  118.     Draw(&area);
  119.  
  120. }    //==== CColorPane::SetPaneColor() ====\\
  121.  
  122.  
  123.  
  124.